package structs

import (
	"zhonghui/console/warehouse/modelx/model_zh_kernel"
	"zhonghui/console/warehouse/structx"
)

type PostSignInReq struct {
	Phone     string `json:"phone"`
	Password  string `json:"password"`
	Code      string `json:"code"`
	Otp       string `json:"otp"`
	OtpFlag   string `json:"otp_flag"`
	ClientUid string `json:"client_uid"`
}

type PostSignInResp struct {
	Token         string `json:"token"`
	TokenExpireIn int64  `json:"token_expire_in"`
	UserId        uint   `json:"user_id"`
}

type PostBindReq struct {
	Code string `json:"code"`
}

type SignInNeedOtpResp struct {
	OtpFlag string `json:"otp_flag"`
	Name    string `json:"name"`
}

type GetUserResp struct {
	Id        uint   `json:"id"`
	Nickname  string `json:"nickname"`
	RealName  string `json:"real_name"`
	Phone     string `json:"phone"`
	Position  string `json:"position"`
	OpenId    string `json:"open_id"`
	IsAdmin   bool   `json:"is_admin"`
	IsBp      bool   `json:"is_bp"`
	CreatedAt string `json:"created_at"`
}

type SignInOtpReq struct {
	Phone    string `json:"phone"`
	Password string `json:"password"`
	Code     string `json:"code"`
}

type SignInOtpResp struct {
	Token         string `json:"token"`
	TokenExpireIn int64  `json:"token_expire_in"`
	UserId        uint   `json:"user_id"`
}

type GetUsersResp struct {
	Id        uint     `json:"id"`
	Phone     string   `json:"phone"`
	RealName  string   `json:"real_name"`
	Position  string   `json:"position"`
	Nickname  string   `json:"nickname"`
	IsActive  bool     `json:"is_active"`
	Groups    []string `json:"groups"`
	CreatedAt string   `json:"created_at"`
}

type PostUsersReq struct {
	Phone    string `json:"phone" binding:"required"`
	RealName string `json:"real_name" binding:"required"`
	Position string `json:"position" binding:"required"`
}

type PostUsersResp struct {
	Phone    string `json:"phone"`
	Password string `json:"password"`
	OtpUrl   string `json:"otp_url"`
}

type PutUsersReq struct {
	RealName string `json:"real_name" binding:"required"`
	Position string `json:"position" binding:"required"`
	IsActive bool   `json:"is_active"`
}

type GetGroupsResp struct {
	Id            uint   `json:"id"`
	Name          string `json:"name"`
	ManagersCount int    `json:"managers_count"`
	CreatedAt     string `json:"created_at"`
}

type GetGroupsUsersResp struct {
	Id        uint   `json:"id"`
	Phone     string `json:"phone"`
	RealName  string `json:"real_name"`
	Position  string `json:"position"`
	Nickname  string `json:"nickname"`
	IsActive  bool   `json:"is_active"`
	CreatedAt string `json:"created_at"`
}

type PostGroupsReq struct {
	Name string `json:"name"`
}

type PostGroupsMembersReq struct {
	UserIds []uint `json:"user_ids"`
}

type GetPoliciesResp struct {
	Id   uint   `json:"id"`
	Name string `json:"name"`
	Code string `json:"code"`
	Conf string `json:"conf"`
}

type GetPermissionsReq struct {
	Entity   string `form:"entity"`
	EntityId uint   `form:"entity_id"`
}

type GetPermissionResp struct {
	Id   uint   `json:"id"`
	Name string `json:"name"`
	Code string `json:"code"`
	Conf string `json:"conf"`
}

type PutPermissionsReq struct {
	Entity    string `json:"entity"`
	EntityId  uint   `json:"entity_id"`
	PolicyIds []uint `json:"policy_ids"`
}
type PageContent struct {
	Head     string `json:"head"`
	Describe string `json:"describe"`
	Footer   string `json:"footer"`
}

type GetMpMarketingResp struct {
	PageOne  PageContent `json:"page_one"`
	PageTwo  PageContent `json:"page_two"`
	ConfigId string      `json:"config_id"`
	Qrcode   string      `json:"qrcode"`
}

type GetH5MarketingResp struct {
	MpSchemaPolicy string `json:"mp_schema_policy"`
	MpSchemaGift   string `json:"mp_schema_gift"`
}

type CreateTaskRequest struct {
	Title      string `json:"title" binding:"required"`
	Source     string `json:"source" binding:"required"`
	Remark     string `json:"remark"`
	TemplateID string `json:"template_id"`
	ConfigID   string `json:"config_id" binding:"required"`
}

type GetTaskListReq struct {
	structx.NormalPagerReq
	State string `form:"state"`
}

type GetTaskListResp struct {
	ID              uint64 `json:"id"`
	Title           string `json:"title"`
	State           string `json:"state"`
	Count           uint64 `json:"count"`
	CountSuccess    uint64 `json:"count_success"`
	CountFail       uint64 `json:"count_fail"`
	Progress        uint64 `json:"progress"`
	Remark          string `json:"remark"`
	ConfigID        string `json:"config_id"`
	TemplateID      string `json:"template_id"`
	TemplateContent string `json:"template_content"`
	CreatedAt       string `json:"created_at"`
	UpdatedAt       string `json:"updated_at"`
}

type TestTaskReq struct {
	Phone string `json:"phone"`
}

type TestTaskResp struct {
	Phone     string `json:"phone"`
	Dwz       string `json:"dwz"`
	SmsResult string `json:"sms_result"`
}

type TaskChartsResp struct {
	Count        uint64 `json:"count"`
	CountSuccess uint64 `json:"count_success"`
	CountFail    uint64 `json:"count_fail"`
	FailRate     string `json:"fail_rate"`
	Progress     uint64 `json:"progress"`

	VisitData []ChartsKV `json:"visit_data"`

	ClickCharts                  *ClickChartsData                  `json:"click_charts"`
	MpCharts                     *MpChartsData                     `json:"mp_charts"`
	WeComCharts                  *WeComChartsData                  `json:"wecom_charts"`
	InsurancePolicyCharts        *InsurancePolicyChartsData        `json:"insurance_policy_charts"`
	InsurancePolicyUpgradeCharts *InsurancePolicyUpgradeChartsData `json:"insurance_policy_upgrade_charts"`
}

type GetAnalysisResp struct {
	Count     uint64 `json:"count"`
	CountFail uint64 `json:"count_fail"`
	FailRate  string `json:"fail_rate"`

	VisitData []ChartsKV `json:"visit_data"`

	ClickCharts           *ClickChartsData           `json:"click_charts"`
	MpCharts              *MpChartsData              `json:"mp_charts"`
	WeComCharts           *WeComChartsData           `json:"wecom_charts"`
	InsurancePolicyCharts *InsurancePolicyChartsData `json:"insurance_policy_charts"`
	AreaCharts            []UserPropChartsData       `json:"area_charts"`
	DeviceCharts          []UserPropChartsData       `json:"device_charts"`
	UserCharts            *TotalUserSummaryData      `json:"user_charts"`
}

type SmsTemplateResp struct {
	Name       string `json:"name"`
	TemplateID string `json:"template_id"`
}

type TaskChartsDownload struct {
	Task                  model_zh_kernel.SysTask
	Tp                    model_zh_kernel.SysSmsTemplate
	ClickCharts           *ClickChartsData           `json:"click_charts"`
	MpCharts              *MpChartsData              `json:"mp_charts"`
	WeComCharts           *WeComChartsData           `json:"wecom_charts"`
	InsurancePolicyCharts *InsurancePolicyChartsData `json:"insurance_policy_charts"`
}

type ImportPolicyReq struct {
	Source string `json:"source" binding:"required"`
}
